package com.study.pojo;

import lombok.Data;


/**
 * 类名称：Result
 * 描述：
 *
 * @author: Lixx
 * 创建时间: 2025/03/03
 */

@Data
public class Result {
    private Integer code; // 响应代码，1：成功，0：失败
    private String msg; // 响应信息
    private Object data; // 响应数据

    /**
     * @return {@link Result }
     * @author Lixx
     * @date 2025/03/03
     */

    public static Result success(){
        Result result = new Result();
        result.code = 1;
        result.msg = "响应成功";
        return result;
    }

    /**
     * 成功
     *
     * @param obj 对象
     * @return {@link Result }
     */
    public static Result success(Object obj){
        Result result = new Result();
        result.code = 1;
        result.msg = "响应成功";
        result.data = obj;
        return result;
    }

    /**
     * 犯 错
     *
     * @return {@link Result }
     */
    public static Result err(){
        Result result = new Result();
        result.code = 0;
        result.msg = "响应失败";
        return result;
    }

}
